Longest prefix matching is a common feature of many switching applications. Using types of memory that rely on standard lookups can require tables that are prohibitively large and can take too much time to search. Using memory types that can perform ternary lookups allowing for wildcard values can consume too much power. Therefore, an improved architecture and method are required to improve the function of longest prefix matching in a switch.